Skip to content

Conversation

@lukemelia
Copy link
Contributor

@lukemelia lukemelia commented Jan 28, 2026

Summary

  • Extends file indexing with a render phase that captures FileDef display format templates (isolated, embedded, fitted, atom, head, icon) as prerendered HTML
  • Stores HTML in existing boxel_index HTML columns (no DB migration needed)
  • Rendering is non-fatal — if it fails, file metadata is still stored without HTML
  • Adds fileRender flag to RenderRouteOptions and FileRenderResponse/FileRenderArgs types to the Prerenderer interface
  • Adds prerenderFileRenderAttempt to the render runner, with retry-with-clearCache support
  • Adds HTTP endpoint /prerender-file-render to the prerender server
  • Adds test-context support via card-prerender.gts fileRenderPrerenderTask

Closes CS-10124

🤖 Generated with Claude Code

Extend file indexing with a render phase that creates a FileDef instance
and captures its display format templates (isolated, embedded, fitted,
atom, head, icon) as prerendered HTML, stored in the existing boxel_index
HTML columns. Rendering is non-fatal — if it fails, file metadata is
still stored without HTML.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

Preview deployments

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 43m 38s ⏱️ + 1m 55s
1 925 tests ±0  1 908 ✅ ±0  17 💤 ±0  0 ❌ ±0 
1 940 runs  ±0  1 923 ✅ ±0  17 💤 ±0  0 ❌ ±0 

Results for commit 1c6ddf5. ± Comparison against base commit afa2175.

♻️ This comment has been updated with latest results.

lukemelia and others added 8 commits January 28, 2026 19:18
- Remove unused fileDefCodeRef destructuring in render route
- Fix prettier formatting in card-prerender, prerender-app, render-runner
- Add 'file-render' to kind union type in prerender-proxy-test
- Fix shouldRetryWithClearCache signature line wrapping

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The extract phase already consumes the clear-cache flag, so the render
phase doesn't need to consume it again.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Files with executable extensions (modules) and card JSON files already
have their own prerender paths. Running the FileDef HTML render phase
for these files added ~168 extra Puppeteer page transitions during boot
indexing, causing CI test timeouts. Now only non-code, non-card files
(like .txt, .png, .md) go through the file render phase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The new file HTML render phase adds Puppeteer page transitions for
every file during boot indexing. On CI hardware this pushes the total
indexing time past the previous 60s limit.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Each Puppeteer page transition costs 2-3 seconds, and rendering all
6+ formats (isolated, head, atom, icon, fitted, embedded) for every
file during boot indexing made total time O(files × formats × 3s).
With ~28 files in test realms, this exceeded test timeouts.

Reduce file render to isolated HTML only. Additional formats can be
added back once the rendering pipeline is optimized for batch/parallel
operation. The FileRenderResponse type and index columns remain
unchanged — they simply receive null for the deferred formats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… file renders

Three root causes of realm-server test timeouts:

1. Missing /prerender-file-render proxy route in manager-app.ts caused boot
   servers to 404 when calling prerenderFileRender through the manager.

2. expectedId mismatch in render-runner.ts: captureResult expected URL without
   .json extension but the render route sets cardId to the raw URL including
   .json, causing each .json file to timeout at 30s waiting for a DOM match.

3. Module files (.gts/.ts/.js) got redundant file renders via indexFile()
   since visitFile() always falls through to indexFile() after indexModule().
   Added hasModulePrerender flag to skip file render for modules that already
   produce HTML through their module prerender path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The three root causes of the timeout have been fixed (missing manager
proxy route, expectedId mismatch, redundant module file renders), so
the inflated 180s timeout is no longer needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@lukemelia lukemelia requested review from a team and backspace January 29, 2026 22:02
@lukemelia
Copy link
Contributor Author

@codex Review please

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c6ddf539e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +264 to +268
let instance = (await cardApi.createFromSerialized(
resource,
doc,
resource.id ? new URL(resource.id) : undefined,
)) as unknown as CardDef;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use authenticated store for fileRender instances

The fileRender path instantiates the card via cardApi.createFromSerialized without passing a store, which means it falls back to FallbackCardStore (see packages/base/card-api.gts) that fetches related resources with the global fetch and no auth context. If a FileDef template touches linked/computed fields that need realm auth, those loads will 401 or be skipped, so prerendered HTML can be incomplete or incorrect. The normal render path wires instances through this.store.add/store.loaded() to ensure authenticated loading; this new branch should do the same or pass the render store into createFromSerialized.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants